/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package projetojpa;

import DAO.DAO;
import entity.Pessoa;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.EntityTransaction;
import javax.persistence.Persistence;
import javax.swing.JOptionPane;

/**
 *
 * @author Thiago
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
/*        EntityManagerFactory factory;
    EntityManager en;
    EntityTransaction transaction;

        factory = Persistence.createEntityManagerFactory("ProjetoJPAPU");
        en = factory.createEntityManager();
        transaction = en.getTransaction();

        Pessoa p = new Pessoa();
        p.setPessoaNome("thiago45689787954664");

        try {
            transaction.begin();
            en.persist(p);
            transaction.commit();

        } catch (Exception e) {
            transaction.rollback();
            JOptionPane.showMessageDialog(null, e.getMessage());
        }

*/
        Pessoa p = new Pessoa();
        DAO dao= new DAO();
        
        p.setPessoaNome("thiago new teste");
        dao.salva(p);

    }
}



